{% extends myBundleName ~ ':Layout:layout.html.twig' %}

{% block title %}{{ myTitlePrefix }} Results{% endblock %}

{% block content %}
<div style="padding: 5px; margin: 5px; border: 5px solid black; width: 300px;">
<form action="{{ path('zayso_core_schedule_results2011') }}" method="post" {{ form_enctype(searchForm) }}>
    {{ form_widget(searchForm.div)  }}
    {{ form_widget(searchForm.pool) }}
    <input type="submit" name="submit_search" value="Search"  />
    {{ form_rest(searchForm) }} 
</form>
</div>        
<div>
    <h3>Results 2011</h3>
    {% for poolKey, pool in pools %}
    <table border = "1">
        <tr><th colspan="16">Game Pool Results - {{ poolKey }}</th></tr>
        <tr><td colspan="16">GS=Goals Scored, PE=Points Earned, PM=Minus Points</td></tr>
        <tr>
            <td>Game</td>
            <td>Status</td>
            <td>Scores</td>
            <td>PA</td>
            <td>DOW Time</td>
            <td>Field</td>
            <td>Pool</td>
            <td>Home Team</td>
            <td>GS</td>
            <td>PM</td>
            <td>PE</td>
            <td>&nbsp;</td>
            <td>PE</td>
            <td>PM</td>
            <td>GS</td>
            <td>Away Team</td>
        </tr>
        {% for game in pool.games %}
        <tr id="ref-sched-{{game.num}}" class="game-status-{{game.status}}">
            <td>
                {% if game.reportStatus != 'Futurex' %}
                    <a  href="{{ path('zayso_core_schedule_game_report', { 'id': game.id })}}"
                        class="game-report-status-{{game.reportStatus}}">
                        {{ game.getNum() }}
                    </a>
                {% else %}
                   <a href="{{ path('zayso_core_schedule_game_report', { 'id': game.id })}}">{{ game.getNum() }}</a> 
                {% endif %}
            </td>
            <td>{{ game.status         }}</td>
            <td>{{ game.reportStatus   }}</td>
            <td>{{ game.pointsApplied  }}</td>
            <td>{{ game_dow(game.date) }} {{ game_time(game.time) }}</td>
            <td>{{ game.fieldDesc      }}</td>
            <td>{{ game.pool           }}</td>
            
            {% set homeTeamRel = game.homeTeam %}
            {% set awayTeamRel = game.awayTeam %}
            {% set homeTeam    = homeTeamRel.team %}
            {% set awayTeam    = awayTeamRel.team %}
            <td>{{ game_team_desc(homeTeamRel) }}</td>
            <td>{{ homeTeam.goalsScored     }}</td>
            <td>{{ homeTeam.pointsMinus     }}</td>
            <td>{{ homeTeam.pointsEarned    }}</td>
            <td>&nbsp;</td>
            <td>{{ awayTeam.pointsEarned    }}</td>
            <td>{{ awayTeam.pointsMinus     }}</td>
            <td>{{ awayTeam.goalsScored     }}</td>
            <td>{{ game_team_desc(awayTeamRel) }}</td>
                    
        </tr>
        {% endfor %}       
    </table>
    <table border = "1">
        <tr><th colspan="16">Team Pool Results - {{ poolKey }}</th></tr>
        <tr><td colspan="16">GP=Games Played, GA=Goals Allowed, YC=Yellow Cards, RC=Red Cards, SP=Sportsmanship</td></tr>
        <tr>
            <td>Pool</td>
            <td>Team</td>
            <td>PE</td>
            <td>&nbsp;</td>
            <td>PM</td>
            <td>GP</td>
            <td>GW</td>
            <td>GS</td>
            <td>GA</td>
            <td>YC</td>
            <td>RC</td>
            <td>CD</td>
            <td>SD</td>
            <td>SP</td>
        </tr>
        {% for team in pool.teams %}
        <tr>
            <td>{{ team.teamKey }}</td>                  
            <td>{{ team.parentTeamKey   }}</td>                  
            <td>{{ team.pointsEarned () }} </td>
            <td>&nbsp;</td>
            <td>{{ team.pointsMinus   }} </td>                  
            <td>{{ team.gamesPlayed   }} </td>                  
            <td>{{ team.gamesWon      }} </td>                  
            <td>{{ team.goalsScored   }} </td>                  
            <td>{{ team.goalsAllowed  }} </td>                  
            <td>{{ team.cautions      }} </td>                  
            <td>{{ team.sendoffs      }} </td>                  
            <td>{{ team.coachTossed   }} </td>                  
            <td>{{ team.specTossed    }} </td>                  
            <td>{{ team.sportsmanship }} </td>                  
       </tr>
       {% endfor %}       
    </table>
    {% endfor %}
</div>
{% endblock %}
